package com.hc.server.listener;

import java.util.Timer;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * Application Lifecycle Listener implementation class UnlockRes
 *
 */
public class SystemMonitor implements ServletContextListener {

	private Timer unlockResTimer;
	
    /**
     * Default constructor. 
     */
    public SystemMonitor() {
       
    }

	/**
     * @see ServletContextListener#contextInitialized(ServletContextEvent)
     */
    public void contextInitialized(ServletContextEvent arg0) {
    	unlockResTimer = new Timer();
    	unlockResTimer.schedule(new UnlockResTask(), 0, 180000);//每3分钟检查一次
    }

	/**
     * @see ServletContextListener#contextDestroyed(ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent arg0) {
        unlockResTimer.cancel();
    }
	
}
